12 for (int c
=0; c
<C
; c
++){
13 if (c
> 0) cout
<< endl
;
15 while (getline(cin
, line
) && line
!= ""){
16 m
.push_back("0" + line
);
19 m
.insert(m
.begin(), string(n
+1, '0'));
22 dp[i][j] = suma de la matriz que va desde la esquina (0,0) hasta la esquina (i,j)
25 for (int i
=0; i
<=n
; ++i
)
26 for (int j
=0; j
<=n
; ++j
)
27 dp
[i
][j
] = m
[i
][j
] - '0';
29 for (int i
=1; i
<=n
; ++i
)
30 for (int j
=1; j
<=n
; ++j
)
31 dp
[i
][j
] += dp
[i
-1][j
] + dp
[i
][j
-1] - dp
[i
-1][j
-1];
34 for (int i
=1; i
<=n
; ++i
)
35 for (int j
=1; j
<=n
; ++j
)
36 for (int a
=i
; a
<=n
; ++a
)
37 for (int b
=j
; b
<=n
; ++b
){
38 if ( ( dp
[a
][b
] - dp
[a
][j
-1] - dp
[i
-1][b
] + dp
[i
-1][j
-1] ) == (a
- i
+ 1)*(b
- j
+ 1) ){
39 answer
= max(answer
, (a
-i
+1)*(b
-j
+1));
43 cout
<< answer
<< endl
;